#include <iostream>
#include <set>

int main() {
    using IntType = long long int;

    IntType rown, coln;
    std::cin >> rown >> coln;

    std::set<IntType> selected_rows, selected_cols;
    
    int q;
    std::cin >> q;

    for (int i = 0; i < q; ++i) {
        IntType flag, val;
        std::cin >> flag >> val;
        if (flag == 0) {  // row
            if (val > 0 && val <= rown) {
                selected_rows.insert(val);
            }
        } else {  // col
            if (val > 0 && val <= coln) {
                selected_cols.insert(val);
            }
        }
    }
    
    auto f = [](IntType rown, IntType coln, IntType rows, IntType cols) {
        return (rown - rows) * (coln - cols);
    };

    std::cout << f(rown, coln, selected_rows.size(), selected_cols.size());
}

